<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layuiAdmin 后台管理员</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="__STATIC__/layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="__STATIC__/layuiadmin/style/admin.css" media="all">
  <style>
    .layui-form-select dl{ max-height: 200px; }
  </style>
</head>
<body>

<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">

  <div class="layui-form-item">
    <label class="layui-form-label">目录名称</label>
    <div class="layui-input-inline">
      <input type="text" name="title" lay-verify="required" placeholder="目录名称" autocomplete="off" class="layui-input" value="{$data['title']}">
      <input type="hidden" name="id" value="{$data['id']}">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">目录名称</label>
    <div class="layui-input-inline">
      <div id="test12" class="demo-tree-more"></div>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">审核状态</label>
    <div class="layui-input-inline">
      <input type="checkbox" lay-filter="switch" name="status" lay-skin="switch" lay-text="使用中|暂停" {if $data['status'] == 1}checked {/if} >
    </div>
  </div>
  <div class="layui-form-item layui-hide">
    <input type="button" lay-submit lay-filter="LAY-add-route-submit" id="LAY-add-route-submit" value="确认">
  </div>
</div>


 <script src="__STATIC__/layuiadmin/layui/layui.js"></script>
  <script>
  layui.config({
    base: '__STATIC__/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'table','tree'], function(){
    var $ = layui.$
    ,form = layui.form
    ,tree = layui.tree
    ,table = layui.table;
    $.ajax({
      type:"POST",
      url:"edit",
      data:{'id':{$data['id']}},
      dataType:"json",
      success:function (res) {
        console.log(res);


        //基本演示
        tree.render({
          elem: '#test12'
          ,data: res
          ,showCheckbox: true  //是否显示复选框
          ,id: 'demoId1'
          ,click: function(obj){
            var data = obj.data;  //获取当前点击的节点数据
            layer.msg('状态：'+ obj.state + '<br>节点数据：' + JSON.stringify(data));
          }
        });

        //获得选中的节点
        // var checkData = tree.getChecked('demoId');

      }
    });



  });
  </script>
</body>
</html>

